| 1 | import { NextRequest, NextResponse } from 'next/server'; |
| 2 | import { updateTask } from '@/lib/db'; |
| 3 | |
| 4 | export const runtime = 'nodejs'; |
| 5 | export const dynamic = 'force-dynamic'; |
| 6 | |
| 7 | export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { |
| 8 | const { id } = await params; |
| 9 | const patch = await req.json(); |
| 10 | const t = updateTask(id, patch); |
| 11 | if (!t) return NextResponse.json({ error: 'not found' }, { status: 404 }); |
| 12 | return NextResponse.json({ task: t }); |
| 13 | } |